package software_construction.PatternProject.d4_observer.demo2;

public class WeatherData {
    private ReapingMachine reapingMachine;
    private SeedingMachine seedingMachine;
    private WateringMachine wateringMachine;

    public WeatherData(ReapingMachine reapingMachine, SeedingMachine seedingMachine, WateringMachine wateringMachine) {
        this.reapingMachine = reapingMachine;
        this.seedingMachine = seedingMachine;
        this.wateringMachine = wateringMachine;
    }

    public void measurementsChanged(int temp, int humidity, int windPower) {
        if (temp > 5) {
            seedingMachine.start();
            if (humidity > 65) {
                reapingMachine.start();
            }
        }
        if (temp > 10 && humidity < 55 && windPower < 4) {
            wateringMachine.start();
        }
    }

}
